<div id="sidebar">
        <?php if (is_front_page()) { ?> 
        <h4>Serving Southeastern Pennsylvania</h4>
        <ul id="servicesList">
        <?php 
        // use wp_list_pages to display parent and all child pages all generations (a tree with parent)
        $parent = 10;
        $args=array(
          'child_of' => $parent
        );
        $pages = get_pages($args);  
        if ($pages) {
          $pageids = array();
          foreach ($pages as $page) {
            $pageids[]= $page->ID;
          }
        
          $args=array(
            'title_li' => '',
            'include' =>  $parent . ',' . implode(",", $pageids)
          );
          wp_list_pages($args);
        }
        ?>
        </ul><!-- servicesList -->
        <p class="billPay"><a class="newwindow" href="https://pay1.plugnpay.com/bpl/lp2069589">Online Bill Pay</a></p>
        <p class="scheduleConsultation"><a href="/contact-us/schedule-a-consultation/">Schedule Consultation</a></p>
        <?php } else { ?>
        <ul id="sidebarNav">
          <?php
          $output = wp_list_pages('echo=0&depth=1&title_li=<h5>Additional Resources</h5>' );
          if (is_page( )) {
            $page = $post->ID;
            if ($post->post_parent) {
              $page = $post->post_parent;
            }
            $children=wp_list_pages( 'echo=0&child_of=' . $page . '&title_li=' );
            if ($children) {
              $output = wp_list_pages ('echo=0&child_of=' . $page . '&title_li=<h5>Additional Resources</h5>');
            }
          }
          echo $output;
          ?>
        </ul>
        <!-- Start Wordpress Loop -->
        <h5>Recent News &amp; Events</h5>
        <?php query_posts('posts_per_page=3'); //returns only the front page?>
        <?php while ( have_posts() ) : the_post() ?>
        <div class="sidePost" id="post-<?php the_ID(); ?>">
          <h2><a href="<?php the_permalink(); ?>" title="Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2> <!-- the_permalink links to your post page, the_title_attribute is the title of your post, so does the_title (but we use the attribute one when it's part of the title attribute  -->
          <div class="post-content">
            <?php the_excerpt_reloaded(0, '<a><p><h1><h2><h3><h4><h5><h6><span><strong><em>', 'none', TRUE, 'Read More', TRUE, 1, TRUE); ?>
          </div><!-- post-content -->
        </div><!-- .sidePost -->
        <?php endwhile; ?>
        <!-- <?php global $sociable; echo $sociable->get_links(); ?> -->
        <p class="billPay"><a class="newwindow" href="https://pay1.plugnpay.com/bpl/lp2069589">Online Bill Pay</a></p>
        <p class="scheduleConsultation"><a href="/contact-us/schedule-a-consultation/">Schedule Consultation</a></p>
        <?php } ?>
      </div><!-- sidebar -->